__weak kullanim amaci
Merhaba aşağidaki kodda _weak ve weakself alanlarinin kullanim mantiğini tam olarak anlayamadim.
Yardimci olabilir misiniz?
[code]
ACAccountType *twitterAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
__weak MasterViewController *weakSelf = self;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[weakSelf.accountStore requestAccessToAccountsWithType:twitterAccountType options:nil completion:^(BOOL granted, NSError *error) {
if (granted)
{
NSArray *twitterAccounts = [weakSelf.accountStore accountsWithAccountType:twitterAccountType];
if (twitterAccounts && [twitterAccounts count] > 0)
{
weakSelf.twitterAccount = twitterAccounts[0];
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf refreshPearsonFeed];
});
}
}
else
{
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
});
}
}];
});
[/code]